package com.viking.XFT;

import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;


public class XFTBootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (context.getSharedPreferences(FloatMain.PREF_NAME, Context.MODE_PRIVATE).getBoolean(FloatMain.PREF_KEY_SOB, false)) {
            DevicePolicyManager device_policy_manager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
            ComponentName admin_component = new ComponentName(context.getPackageName(), XFTDeviceAdminReceiver.class.getName());
            if (device_policy_manager.isAdminActive(admin_component)){
                context.startService(new Intent(context, FloatService.class));
            }
        }
    }

}